
<div id="containerSlider" class="containerSlider">
    <div id="slides">
    	 <?php 
    require_once ('pages/connexion.php');
    $sql = 'SELECT * FROM diapositives WHERE voir=:voir ORDER BY ordre';
    $select = $connection->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    $select->execute(array(':voir' => 'oui'));
    While ( $enregistrement = $select->fetch(PDO::FETCH_OBJ)){
    	
    	$sql2 = 'SELECT * FROM images WHERE id=:idImages';
    	$select2 = $connection->prepare($sql2, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    	$select2->execute(array(':idImages' => $enregistrement->idImages));
    	$enregistrement2 = $select2->fetch(PDO::FETCH_OBJ);
    	
		if (($enregistrement->contenu!="") || ($enregistrement->chemin!="") || ($enregistrement->lienVers!="") || ($enregistrement->idElt!="")){
		?>
			<p>
				<img class="imgSlider" src="images/<?php echo $enregistrement2->chemin;?>"/>
				<span class="titleSlider"><?php echo $enregistrement->nom;?></span>
				
				<?php
				if ($enregistrement->lienVers=="linkExterne"){
				?>
					
					<a title="En savoir plus" class="linkSlider"  target="_blank" href="http://<?php echo $enregistrement->chemin;?>">
				<?php
				}else{
				?>
					<a title="En savoir plus " class="linkSlider" onClick="return redirectionSlider('<?php echo $enregistrement->lienVers;?>','<?php echo $enregistrement->chemin;?>','<?php echo $enregistrement->idElt;?>','<?php echo $enregistrement->nomElt;?>','<?php echo $enregistrement->typeElt;?>');">
	    						
				<?php
				}
				 		echo $enregistrement->contenu;?>	    		
					</a>				
	    	</p>
		<?php 			
		}else{
		?>
			<p><img class="imgSlider" src="images/<?php echo $enregistrement2->chemin;?>"></p>
		<?php
		}
    }
    ?>

    </div>
  </div>
 
